<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <table border="1">
        <thead>
            <tr>
                <td>姓名</td>
                <td>性别</td>
                <td>年龄</td>
            </tr>
        </thead>
        <tbody id="tbody">
            <tr>
                <td>张三</td>
                <td>男</td>
                <td>20</td>
            </tr>
        </tbody>
    </table>
    <input id="addBtn" type="button" value="添加内容">
    <script>
        let addBtn = document.getElementById("addBtn");
        addBtn.onclick = function(){
            let tbody = document.getElementById("tbody");
            let tr = document.createElement("tr");
            let td1 = document.createElement("td");
            let td2 = document.createElement("td");
            let td3 = document.createElement("td");
            let txt1 = document.createTextNode("李四");
            let txt2 = document.createTextNode("女");
            let txt3 = document.createTextNode("22");

            td1.appendChild(txt1);
            td2.appendChild(txt2);
            td3.appendChild(txt3);
            tr.appendChild(td1);
            tr.appendChild(td2);
            tr.appendChild(td3);

            tbody.appendChild(tr);
        }
    </script>
</body>
</html>